package com.example.survey_determination.service.impl;

import com.example.survey_determination.controller.ReportedInfoController;
import com.example.survey_determination.dao.ReportedInfoDao;
import com.example.survey_determination.dao.SurveyLossInfoDao;
import com.example.survey_determination.dao.TaskInfoDao;
import com.example.survey_determination.service.TaskInfoService;
import entity.reported_info;
import entity.task_info;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * (TaskInfo)表服务实现类
 *
 * @author makejava
 * @since 2022-01-06 09:45:03
 */
@Service("taskInfoService")
public class TaskInfoServiceImpl implements TaskInfoService {
    @Resource
    private TaskInfoDao taskInfoDao;
    @Resource
    private ReportedInfoDao reportedInfoDao;
    @Resource
    private SurveyLossInfoDao SurveyLossInfoDao;

    @Override
    public List<task_info> selectTask_info(Integer dispose_people_number)
    {
        List<task_info> ss=this.taskInfoDao.selectTask_info(dispose_people_number);
        for (task_info s:ss
             ) {
            System.out.println(s.getReported_number());
            s.setReported_info(reportedInfoDao.queryById(s.getReported_number()));
        }
        System.out.println(ss.toArray());
        return ss;
    }

    @Override
    public int updateService_schedule2(String reported_number) {
        return this.taskInfoDao.updateService_schedule2(reported_number);
    }

    @Override
    public int updateService_schedule(String reported_number) {
        return taskInfoDao.updateService_schedule(reported_number);
    }

    @Override
    public int insert(task_info task_info) {
        this.SurveyLossInfoDao.updateTasking_job_number(task_info.getDispose_people_number());
        return this.taskInfoDao.insert(task_info);
    }


}
